import { Observer } from 'mobx-vue'
import { Component, Vue } from 'vue-property-decorator'
import { getMinqingList } from 'src/utils/axios'
import PubArea from "../components/pubArea/pubArea.vue"
require('./minqing.scss')
@Observer
@Component({
    components:{
        PubArea
    }
    
})
export default class ZtCommunity extends Vue {
    name:any = '';
    page: number = 1;
    count: number = 0;//总页数
    tableData:any = [];
    queryForm:any = {
        name: '',
        grid_code: ''
    }
    tableColums:any= [
        {
            title: '#ID',
            key: 'id'
        },
        {
            title: '所属街道',
            key: 'street_name'
        },
        {
            title: '所属社区',
            key: 'community_name'
        },
        {
            title: '所属网格',
            key: 'grid_name'
        },
        {
            title: '所属小区',
            key: 'complex_name'
        },
        {
            title: '联系人',
            key: 'contact'
        },
        {
            title: '联系方式',
            key: 'contact'
        },
        {
            title: '图片',
            slot: 'image'  
        },
        {
            title: '创建时间',
            key: 'time'
        },
        {
            align: 'center',
            title: '操作',
            slot: 'operation'
        }
    
    ]
    
    mounted() {
       let vm:any = this;
       vm.getList(1);
    }
    projectType(image){
        return "123"
    }
    async getList(page){
        let vm:any = this;
        let params:any = {
            "filter": {
                // "street_code": window.localStorage.getItem("street_code")
            },
            "range": [(page-1)*10, page * 10],
            "sort": []
        }
        
        let out:any = await getMinqingList(params);
        if (!out.status) {
            // if (!out.data.list.length && page > 1) {
            //     vm.getList(page)
            //     return
            // }
            vm.page = page
            vm.count = out.data.total;
            vm.tableData = out.data.list
            console.log('vm.tableData',vm.tableData)
        }else {
            vm.$Message.error(await vm.$api.xerror(out.status));
        }
    }
     //改变页码
     async changePage(index) {
        this.getList(index)
    }

}
